#include "edgeSol.h"
#include <stdlib.h>

PedgeSol initEdgeSol(PedgeID pe, int _x){
	PedgeSol result = (PedgeSol)malloc(sizeof(EdgeSol));
	checkMalloc(result,"edgesol.c:initedgesol:1");
	result->id = initEdgeID(pe->i,pe->j);
	result->x = _x;
	return result;
}

//TODO testing
PedgeSol initEdgeSolCustomized(PedgeID pe, int _x, int _marked){
	PedgeSol result=initEdgeSol(pe,_x);
	result->marked=_marked;
	return result;
}

PedgeSol cloneEdgeSol(PedgeSol edgesol){
	PedgeSol result = (PedgeSol)malloc(sizeof(EdgeSol));
	checkMalloc(result,"edgesol.c:cloneEdgesol:1");
	result->id = initEdgeID(edgesol->id->i,edgesol->id->j);
	result->x = edgesol->x;
	result->marked=edgesol->marked;
	return result;
}

void freeEdgeSol(PedgeSol pes){
	freeEdgeID(pes->id);
	pes->marked=0;
	pes->x=0;
	free(pes);
}
void printEdgeSol(FILE* f, PedgeSol pes){
	printEdgeID(f, pes->id);
	fprintf(f,"[x:%d]\t", pes->x);
}
